home *** CD-ROM | disk | FTP | other *** search
- /* FILE: PStrCat.c
- Concatenates 2-30 Pascal strings. */
- #include "PStrLib.h"
-
- PStrCat(count, dst)
- register int count; /* # of strings (including dst) */
- unsigned char *dst; /* destination pascal string */
- {
- register unsigned char *dstPtr, *srcPtr;
- register unsigned char **argList = &dst;
- register int argLen, totLen;
-
- if ((totLen = *dst) < 255) {
- if (count > 30)
- count = 30; /* max. # of string args is 30 */
- dstPtr = dst + totLen; /* dstPtr = 1 past end of dst */
- while (--count > 0 && totLen < 255) {
- srcPtr = *++argList;
- argLen = srcPtr[0];
- if (totLen + argLen > 255)
- argLen = 255 - totLen; /* max totLen = 255 */
- totLen += argLen;
- while (--argLen >= 0) /* add arg's char to dst */
- *++dstPtr = *++srcPtr;
- }
- dst[0] = totLen; /* sets length of dst */
- }
- }